package cqut.wys.repository;

import cqut.wys.domain.City;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import java.util.List;

/**
 * Created by wuyoushan on 2017/9/25.
 */
public interface CityRepository extends ElasticsearchRepository<City,Long>{

    /**
     * AND 语句查询
     *
     * @param description 描述
     * @param score 匹配度
     * @return List<City>
     */
    List<City> findByDescriptionAndScore(String description, Integer score);

    /**
     * OR 语句查询
     *
     * @param description 描述
     * @param score 匹配度
     * @return List<City>
     */
    List<City> findByDescriptionOrScore(String description, Integer score);

    /**
     * 查询城市描述
     *
     * @param description 描述
     * @return Page<City>
     */
    Page<City> findByDescription(String description, Pageable pageable);

    /**
     * NOT 语句查询
     *
     * @param description 描述
     * @return Page<City>
     */
    Page<City> findByDescriptionNot(String description,Pageable pageable);

    /**
     * LIKE 语句查询
     *
     * @param description 描述
     * @return Page<City>
     */
    Page<City> findByDescriptionLike(String description,Pageable pageable);
}
